import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { VisitorProgramVO, VisitorProgramForm, VisitorProgramQuery } from '@/api/goods/visitorProgram/types';

/**
 * 查询访客计划列表
 * @param query
 * @returns {*}
 */

export const listVisitorProgram = (query?: VisitorProgramQuery): AxiosPromise<VisitorProgramVO[]> => {
  return request({
    url: '/order/visitorProgram/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询访客计划详细
 * @param id
 */
export const getVisitorProgram = (id: string | number): AxiosPromise<VisitorProgramVO> => {
  return request({
    url: '/order/visitorProgram/' + id,
    method: 'get'
  });
};

/**
 * 新增访客计划
 * @param data
 */
export const addVisitorProgram = (data: VisitorProgramForm) => {
  return request({
    url: '/order/visitorProgram',
    method: 'post',
    data: data
  });
};

/**
 * 修改访客计划
 * @param data
 */
export const updateVisitorProgram = (data: VisitorProgramForm) => {
  return request({
    url: '/order/visitorProgram',
    method: 'put',
    data: data
  });
};

/**
 * 删除访客计划
 * @param id
 */
export const delVisitorProgram = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/visitorProgram/' + id,
    method: 'delete'
  });
};

export default {
  list: listVisitorProgram,



  get: getVisitorProgram,


  add: addVisitorProgram,

  update: updateVisitorProgram,
  del: delVisitorProgram,
}